﻿
namespace TemplateFoundation.UI.WebControls
{
    /// <summary>
    /// Used to add a link selector based on InputPageReference
    /// </summary>
    public class LinkSelector : PagePropertyStyleControlBase
    {
        private readonly SimplePropertyUrlControl _control = new SimplePropertyUrlControl();

        /// <summary>
        /// Creates a new link selector with standard name and description
        /// </summary>
        public LinkSelector()
        {
            Name = "Link";
            Description = "Select a link";
        }

        /// <summary>
        /// Used to create the control to render as a property control
        /// </summary>
        /// <returns></returns>
        public override System.Web.UI.Control CreatePropertyControl()
        {
            return _control;
        }
        
        /// <summary>
        /// Gets the selected URL
        /// </summary>
        public string SelectedUrl
        {
            get
            {
                return _control.SelectedUrl;
            }
            set
            {
                _control.SelectedUrl = value;
            }
        }

        /// <summary>
        /// Gets the client ID of the value control
        /// </summary>
        public string ValueControlId
        {
            get
            {
                return _control.ValueControlId;
            }
        }
    }
}
